package com.liulimi.fastapi.application.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.liulimi.fastapi.core.annotation.DateValidator;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author chenhao
 */
public class UserBean {
    @NotNull
    @Length(max = 20)
    private String name;
    @Min(1)
    private String sex;
    @DateValidator(dateFormat = "yyy-MM-dd")
    private String createTime;
    private int age;
    @JsonFormat
    private long birthday = System.currentTimeMillis();
    private String password;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public UserBean(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public UserBean(String name, String sex, int age,String password) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.password = password;
    }

    public long getBirthday() {
        return birthday;
    }

    public void setBirthday(long birthday) {
        this.birthday = birthday;
    }

    public UserBean() {
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static List<UserBean> userBeansList (){
        List<UserBean> userBeans = new ArrayList<>();
        userBeans.add(new UserBean("chenhao","男",16,"123456"));
        userBeans.add(new UserBean("fengwenbo","男",18,"123"));
        userBeans.add(new UserBean("test","男",16,"123"));
        return userBeans;
    }
}
